package android.kimmy.xlannoprocessor.route;

/**
 * 功能：
 * 描述：
 * Created by 陈俊杰 on 2018/7/19.
 */
public class XLRouteAnnoHelper {

    public static final String ROUTE_PACKAGE_NAME = "net.xuele.android.common.router";

    public static final String GENERATE_ROUTE_SUFFIX_NAME = "RouteContentProvider";
    public static final String OPTION_MODULE_NAME = "moduleName";
    public static final String ACTIVITY_FULL_NAME = "android.app.Activity";
    public static final String CLASS_JAVA_DOC = "Generated by XLRouter. Do not edit it!\n";
    public static final String METHOD_HANDLE = "handleRoute";

    public static String reFormatModuleName(String moduleName) {
        if (moduleName == null) return null;

        moduleName = moduleName.replace(".", "_").replace("-", "_").toLowerCase();
        moduleName = capitalize(moduleName);
        return moduleName;
    }

    public static String capitalize(CharSequence self) {
        return self.length() == 0 ? "" :
                "" + Character.toUpperCase(self.charAt(0)) + self.subSequence(1, self.length());
    }


    public static String getProviderImplPath(String moduleName) {
        moduleName = reFormatModuleName(moduleName);

        return ROUTE_PACKAGE_NAME + "." + moduleName + GENERATE_ROUTE_SUFFIX_NAME;
    }
}
